package com.cloud.es.controller;

import com.alibaba.fastjson.JSON;
import com.cloud.es.feign.EsFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EsController {
    @Autowired
    private EsFeign esFeign;

    @GetMapping("/es/get")
    public String get() {
        esFeign.createIndex();
        esFeign.insert("{\n" +
                "  \"name\":\"yushengjun123\",\n" +
                "  \"sex\":1,\n" +
                "  \"age\":50\n" +
                "}");
        String query = esFeign.query();
        System.out.println(query);
        return esFeign.getNodes();
    }
}
